-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
dcc redesign: refactor TextArea
and Tooltip
#3468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4
Are you sure you want to change the base?
Conversation
1f7f921
to
6bb0f4a
Compare
TextArea
and Tooltip
@T4rk1n please review |
const asNumber = (value?: string | number): number | undefined => { | ||
return typeof value === 'string' | ||
? isNaN(parseInt(value, 10)) | ||
? undefined | ||
: parseInt(value, 10) | ||
: value; | ||
}; | ||
const asBool = (value?: string | boolean): boolean | undefined => { | ||
if (typeof value === 'string') { | ||
if (['true', 'TRUE', 'True'].includes(value)) { | ||
return true; | ||
} | ||
if (['false', 'FALSE', 'False'].includes(value)) { | ||
return false; | ||
} | ||
return undefined; | ||
} | ||
return value; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think those conversion are necessary, the props are transfered in json and bool and number. The prop type should be bool or number but the string interpolation makes it harder on the python type check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your idea here, and pushed up a change that removes string
as an allowed type for these props.
However... these existed for API compatibility (the docs say string
is allowed) so just want you to be aware of the backwards incompatibility that this introduces (especially for numeric props like cols
and maxLength
)
…r-textarea-tooltip' into feature/dcc-refactor-textarea-tooltip
This PR is a small refactor of
Textarea
andTooltip
components to match the current designs and be Typescript components.